﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:extended="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:localCalendar="clr-namespace:SLControlLibrary.Resources.Controls.Calendar.ClassicCalendar"
    xmlns:localButtons="clr-namespace:SLControlLibrary.Resources.Controls.Calendar.Buttons">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SLControlLibrary;component/Resources.Styles/ButtonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Base Calendar -->
    <Style TargetType="localCalendar:ucCalendar">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:ucCalendar">
                    <Grid
                        x:Name="_GrdRoot"
                        VerticalAlignment="Top"
                        HorizontalAlignment="Left"
                        Height="{TemplateBinding ControlHeight}"
                        Width="{TemplateBinding ControlWidth}">

                        <Grid.Resources>
                            <Storyboard x:Name="sbAnimate">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(FrameworkElement.Width)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="25"/>
                                    <SplineDoubleKeyFrame x:Name="AnimateWidth" KeyTime="00:00:01.5000000" Value="180"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="25"/>
                                    <SplineDoubleKeyFrame x:Name="AnimateHeight" KeyTime="00:00:01.5000000" Value="157"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(Canvas.Left)">
                                    <SplineDoubleKeyFrame x:Name="AnimateLeft" KeyTime="00:00:00" Value="146"/>
                                    <SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(Canvas.Top)">
                                    <SplineDoubleKeyFrame x:Name="AnimateTopStart" KeyTime="00:00:00" Value="148"/>
                                    <SplineDoubleKeyFrame x:Name="AnimateTopEnd" KeyTime="00:00:01.5000000" Value="22"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Grid.Resources>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="{TemplateBinding ControlHeight}"/>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Border
                            x:Name="_BrdRoot"
                            Grid.Row="0"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top"
                            Width="{TemplateBinding ControlWidth}"
                            Height="{TemplateBinding ControlHeight}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}">
                            <StackPanel
                                VerticalAlignment="Top"
                                Orientation="Vertical">
                                <localCalendar:ucHeader
                                    x:Name="Header"
                                    Background="{TemplateBinding HeaderBackground}"
                                    ButtonLeftFill="Black"
                                    ButtonRightFill="Black" />
                                <Canvas>
                                    <Border
                                        x:Name="border"
                                        Margin="0,2,0,0"
                                        Width="Auto"
                                        Height="Auto"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        Background="{TemplateBinding Background}" >
                                        <Grid x:Name="grdCollection" />
                                    </Border>
                                </Canvas>
                            </StackPanel>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Calendar Header -->
    <Style TargetType="localCalendar:ucHeader">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:ucHeader">
                    <Border
                        Width="Auto"
                        Height="Auto"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid
                            Height="{TemplateBinding DisplayHeight}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="{TemplateBinding ButtonWidth}" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="{TemplateBinding ButtonWidth}" />
                            </Grid.ColumnDefinitions>

                            <localButtons:ucCalendarButton
                                x:Name="btnLeft"
                                Grid.Column="0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                ButtonType="Left"
                                Background="{TemplateBinding Background}"
                                Width="{TemplateBinding ButtonWidth}"
                                Height="{TemplateBinding ButtonHeight}"
                                ButtonFill="{TemplateBinding ButtonLeftFill}"
                                Style="{StaticResource CalendarButtonStyle}"/>

                            <TextBlock
                                x:Name="txtDisplay"
                                Grid.Column="1"
                                Cursor="Hand"
                                TextAlignment="Center"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Left"
                                Width="{TemplateBinding DisplayWidth}"
                                Text="{TemplateBinding Value}"
                                Foreground="{TemplateBinding Foreground}" />

                            <localButtons:ucCalendarButton
                                x:Name="btnRight"
                                Grid.Column="2"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center"
                                ButtonType="Right"
                                Background="{TemplateBinding Background}"
                                Width="{TemplateBinding ButtonWidth}"
                                Height="{TemplateBinding ButtonHeight}"
                                ButtonFill="{TemplateBinding ButtonLeftFill}"
                                Style="{StaticResource CalendarButtonStyle}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Year/Month -->
    <Style TargetType="localCalendar:ucCalendarItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:ucCalendarItem">
                    <Border
                        x:Name="brdDesc"
                        Cursor="Hand"
                        Height="{TemplateBinding Height}"
                        Width="{TemplateBinding Width}"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Margin="{TemplateBinding Margin}">
                        <TextBlock
                                x:Name="txtDisplay"
                                TextAlignment="Center"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Text="{TemplateBinding Desc}"
                                Foreground="{TemplateBinding Foreground}" >
                        </TextBlock>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Day -->
    <Style TargetType="localCalendar:ucDay">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:ucDay">
                    <Grid
                        x:Name="LayoutRoot"
                        Background="{x:Null}"
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Cursor="{TemplateBinding Cursor}"
                        >
                        <Border
                            x:Name="brdDesc"
                            Canvas.ZIndex="1"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Background="{x:Null}"
                            Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}"
                            Margin="{TemplateBinding Margin}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            >
                            <TextBlock
                                x:Name="txtDisplay"
                                TextAlignment="Center"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Width="{TemplateBinding Width}"
                                Height="{TemplateBinding Height}"
                                Text="{TemplateBinding Desc}"
                                Foreground="{TemplateBinding TextForeground}"
                                FontSize="{TemplateBinding FontSize}"
                                />
                        </Border>
                        <Rectangle
                            x:Name="brdHalfDayTop"
                            Canvas.ZIndex="-1"
                            Margin="0,0,0,1"
                            Stroke="{x:Null}"
                            Height="{TemplateBinding Height}"
                            Width="{TemplateBinding Width}"
                            Fill="{TemplateBinding BorderTopFill}"
                            Clip="{TemplateBinding BorderTopClip}"
                            />
                        <Rectangle
                            x:Name="brdHalfDayBottom"
                            Margin="0,0,0,1"
                            Canvas.ZIndex="-2"
                            Stroke="{x:Null}"
                            Fill="{TemplateBinding BorderBottomFill}"
                            />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>